import java.util.LinkedList;
import java.util.List;
import Application.Client;
import Server.MainServer;


public class Main {
	
// TODO Fix asumptions below:	
	
	/**
	 * Assumptions: 
	 * 1.) MainServer never goes down. 
	 * 2.) All client connections are new. 
	 * 3.) Clients have no previous knowledge of their ID
	 * 
	 * @param args
	 */
	public static void main(String[] args) {
		int numClients = 10;
		
		MainServer server = new MainServer();
		server.startServer();
		
		List<Client> clients = new LinkedList<Client>();
		for (int i = 0; i < numClients; i++) {
			clients.add(new Client());
		}
		
		waitForNetwork();
		
		server.clientDispatcher.sendUnit(numClients);
		server.closeServer();
	}
	
	private static void waitForNetwork() {
		try {
			Thread.sleep(500);
		} catch (InterruptedException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
	
//	public static void main(String[] args) {
//		Random rand = new Random();
//		Class randClass = rand.getClass();
//		Method[] methods = randClass.getDeclaredMethods();
//		
//		for (Method method : methods) {
//			System.out.println(method.getName());
//			for (Class c : method.getParameterTypes())
//				System.out.println("\t- " + c.toString());
//		}
//		
//		Method.setAccessible(methods, true);
//		
////		for (Method method : methods) {
////			System.out.println(method.getParameterTypes());
////		}
//	}
}
